#include <iostream>

using namespace std;

// https://leetcode.cn/problems/xoh6Oh/?envType=problem-list-v2&envId=G25w0aD1

class Solution {
public:
    int divide(int a, int b) {

        if(a == INT32_MIN && b == -1){
            return INT32_MAX;
        }

        long long dividend = abs((long long)a);
        long long divisor = abs((long long)b);

        long long ans = 0;

        // 最终结果符号
        bool symbol = (a >= 0) ^ (b >= 0);

        while (dividend >= divisor)
        {
            long long temp = divisor;
            long long cnt = 1;
            while(dividend >= (temp << 1)){
                cnt <<= 1;
                temp <<= 1;
            }
            dividend -= temp;
            ans += cnt;
        }
        return symbol ? -ans : ans;
    }
};

int main()
{
    return 0;
}